<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace app\agent\controller;

class AgentList extends \app\AgentRest
{
    public function agentList()
    {
        $input = $this->_input;
        $dis[] = ["uniacid", "in", $this->_uniacid_arr];
        $agent_model = new \app\agent\model\AgentList();
        if(!empty($input["level"])) {
            $dis[] = ["level", "=", $input["level"]];
        }
        if(!empty($input["user_name"])) {
            $dis[] = ["user_name", "like", "%" . $input["user_name"] . "%"];
        }
        if(!empty($input["status"])) {
            $icon = $input["status"] == 1 ? ">" : "<";
            $dis[] = ["over_time", $icon, time()];
        }
        if(!empty($input["province_code"])) {
            $dis[] = ["province_code", "=", $input["province_code"]];
        }
        if(!empty($input["city_code"])) {
            $dis[] = ["city_code", "=", $input["city_code"]];
        }
        $data = $agent_model->agentList($dis, $input["page_count"]);
        return $this->success($data);
    }
    public function agentAdd()
    {
        $input = $this->_input;
        $input["uniacid"] = $this->_uniacid;
        $agent_model = new \app\agent\model\AgentList();
        $res = $agent_model->agentAdd($input);
        return $this->success($res);
    }
    public function agentUpdate()
    {
        $input = $this->_input;
        $agent_model = new \app\agent\model\AgentList();
        $data = $agent_model->agentUpdate(["id" => $input["id"]], $input);
        return $this->success($data);
    }
    public function agentInfo()
    {
        $input = $this->_input;
        $agent_model = new \app\agent\model\AgentList();
        $data = $agent_model->agentInfo(["id" => $input["id"]]);
        return $this->success($data);
    }
    public function agentSelect()
    {
        $dis[] = ["uniacid", "in", $this->_uniacid_arr];
        $agent_model = new \app\agent\model\AgentList();
        $data = $agent_model->where($dis)->order("id desc")->field("id,user_name")->select()->toArray();
        return $this->success($data);
    }
}

?>